{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Problem\t1 [Testing\tFaith]\n", "Download\tthe\t“old\t faithful”\tdata set\tfrom\tblackboard.\tThis\tcontains samples\tof\ta\t2-D\trandom\tvariable:\t\n", "the\t first\tdimension\tis\tthe\tduration\tof\tthe\told\t faithful\tgeyser\teruptions.\tThe\tsecond\tis\tthe\twaiting\t time\t\n", "between\teruptions. Generate\ta\t2-D\tscatter\tplot\tof\tthe\tdata.\tRun\ta\tk-means\tclustering\troutine\ton\tthe\tdata\t\n", "for\tk=2.\tShow\tthe\ttwo\tclusters\tin\ta\tscatterplot" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "from sklearn.cluster import KMeans\n", "import seaborn as sns\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | eruption | \n", "waiting | \n", "
---|---|---|
0 | \n", "3.600 | \n", "79 | \n", "
1 | \n", "1.800 | \n", "54 | \n", "
2 | \n", "3.333 | \n", "74 | \n", "
3 | \n", "2.283 | \n", "62 | \n", "
4 | \n", "4.533 | \n", "85 | \n", "